package org.yoki.edu.bg.radius.web.api.client;

import org.yoki.edu.bg.radius.web.api.client.command.ClientCreateCommand;
import org.yoki.edu.bg.radius.web.api.client.command.ClientPageCommand;
import org.yoki.edu.bg.radius.web.api.client.command.ClientUpdateCommand;
import org.yoki.edu.bg.radius.web.api.command.IdsCommand;
import com.yunzhitx.cloud.common.model.InvokeResult;
import com.yunzhitx.cloud.common.model.PageResult;
import org.yoki.edu.bg.radius.vo.client.ClientVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * 代码生成器自动生成
 * Date:2018-1-29 17:48:47
 *
 * @author
 */
@Api(value = "ClientService", description = "Client相关AIP", tags = "ClientService")
@RequestMapping(value = "client")
public interface ClientService {

    /* ************************************************************************************ *
       ***************************************  增  ***************************************
    * ************************************************************************************* */

    /**
     * 新增Client
     *
     * @param command
     * @return
     */
    @PostMapping("add")
    @ApiOperation(value = "新增Client")
    InvokeResult<ClientVO> add(@RequestBody @Valid ClientCreateCommand command);

    /* ******************************************************************************* *
                                            删
     * ******************************************************************************* */

    /**
     * 根据Id，删除
     *
     * @param id
     * @return
     */
    @GetMapping("deleteById")
    @ApiOperation(value = "根据Id，删除模板")
    InvokeResult deleteById(@RequestParam("id") @NotNull Integer id);

    /**
     * 根据Id，删除
     *
     * @param command
     * @return
     */
    @PostMapping("deleteByIds")
    @ApiOperation(value = "根据Id，删除模板")
    InvokeResult deleteByIds(@RequestBody @Valid IdsCommand command);

    /**
     * 根据Ip地址，删除
     *
     * @param ipAddr
     * @return
     */
    @GetMapping("deleteByIpAddr")
    @ApiOperation(value = "根据Ip地址，删除")
    InvokeResult deleteByIpAddr(@RequestParam("ipAddr") @NotBlank String ipAddr);

    /* ************************************************************************************ *
       ***************************************  改  ***************************************
    * ************************************************************************************* */

    /**
     * 根据Id，更新Client
     *
     * @param command
     * @return
     */
    @PostMapping("update")
    @ApiOperation(value = "根据Id，更新Client", httpMethod = "POST")
    InvokeResult<ClientVO> update(@RequestBody @Valid ClientUpdateCommand command);

    /**
     * 根据Id，serverId，更新Client
     *
     * @param id
     * @param serverId
     * @return
     */
    @GetMapping("updateServer")
    @ApiOperation(value = "根据Id，serverId，更新Client", httpMethod = "Get")
    InvokeResult<ClientVO> updateServer(@RequestParam("id") @NotNull Integer id,
                                        @RequestParam("serverId") @NotNull Integer serverId);

    /**
     * 根据isWork状态，更新Client
     *
     * @param id
     * @param isWork
     * @return
     */
    @GetMapping("updateWorkState")
    @ApiOperation(value = "根据isWork状态，更新Client", httpMethod = "GET")
    public InvokeResult updateWorkState(@RequestParam("id") @NotNull Integer id,
                                        @RequestParam("isWork") @NotNull Boolean isWork);

    /* ************************************************************************************ *
       ***************************************  查  ***************************************
    * ************************************************************************************* */

    /**
     * 根据ID获取Client
     *
     * @param id
     * @return
     */
    @GetMapping("getDetailById")
    @ApiOperation(value = "根据ID获取Client", httpMethod = "GET")
    InvokeResult<ClientVO> getDetailById(@RequestParam("id") @NotNull int id);

    /**
     * 根据分页参数以及条件参数获取客户端分页列表
     *
     * @param page
     * @param command
     * @return
     */
    @GetMapping("getPage")
    @ApiOperation(value = "根据分页参数以及条件参数获取客户端分页列表")
    InvokeResult<PageResult<ClientVO>> getPage(PageResult page, @Valid ClientPageCommand command);


}